//
//  CollectionViewCell.m
//  Linkage
//
//  Created by LeeJay on 16/8/22.
//  Copyright © 2016年 LeeJay. All rights reserved.
//

#import "CollectionCategoryModel.h"
#import "CollectionViewCell.h"

@interface CollectionViewCell ()

@property (nonatomic, strong) UIImageView *imageV;
@property (nonatomic, strong) UILabel *name;

@end

@implementation CollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame])
    {
//        self.backgroundColor = UIColor.orangeColor;
        self.imageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.width)];
        self.imageV.contentMode = UIViewContentModeScaleAspectFill;
        [self.contentView addSubview:self.imageV];
        [_imageV hg_setAllCornerWithCornerRadius:6.0f];

        self.name = [[UILabel alloc] initWithFrame:CGRectMake(0, self.frame.size.width + 10, self.frame.size.width, 20)];
        self.name.font = DYFont(15);
        self.name.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:self.name];
    }
    return self;
}

- (void)setModel:(HECategModel *)model
{
    [self.imageV sd_setImageWithURL:[NSURL URLWithString:model.icon] placeholderImage:IMAGE_NAMED(@"noImage")];
    self.name.text = model.name;
}

@end
